package com.sky.codeGenerate.modules.userInfo.controller;

import com.sky.common.basic.Results;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import com.github.pagehelper.PageInfo;

import com.sky.codeGenerate.modules.userInfo.entity.UserInfo;
import com.sky.codeGenerate.modules.userInfo.entity.UserInfoParam;
import com.sky.codeGenerate.modules.userInfo.entity.UserInfoVO;
import com.sky.codeGenerate.modules.userInfo.service.UserInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;


@RestController
@RequestMapping("/userinfo")
public class UserInfoController {

	@Autowired
	private UserInfoService userInfoService;

	/** 查询列表(分页) **/
    @GetMapping("/getUserInfoPage")
    public Results<PageInfo<UserInfoVO>> getUserInfoPage(UserInfoParam param) {
		return new Results().succeed(userInfoService.getUserInfoPage(param));
	}

	/** 查询列表 **/
    @GetMapping("/getUserInfoList")
    public Results<List<UserInfoVO>> getUserInfoList(UserInfoParam param) {
		return new Results().succeed(userInfoService.getUserInfoList(param));
	}

    /** 根据ID获取详情 **/
    @GetMapping("/getUserInfoById")
    public Results<UserInfoVO> getUserInfoById(Integer id) {
		return new Results().succeed(userInfoService.getUserInfoById(id));
	}

    /** 新增 **/
    @PostMapping("/addUserInfo")
    public Results<Integer> addUserInfo(UserInfo param) {
 	    return new Results().succeed(userInfoService.insertUserInfo(param));
     }

    /** 批量新增 **/
    @PostMapping("/addBatchUserInfo")
    public Results<Integer> addBatchUserInfo(List<UserInfo> paramList) {
 	    return new Results().succeed(userInfoService.insertBatchUserInfo(paramList));
     }

    /** 编辑 **/
    @PostMapping("/editUserInfo")
    public Results<Integer> editUserInfo(UserInfo param) {
 	    return new Results().succeed(userInfoService.updateUserInfo(param));
     }

    /** 批量编辑 **/
    @PostMapping("/editBatchUserInfo")
    public Results<Integer> editBatchUserInfo(List<UserInfo> paramList) {
 	    return new Results().succeed(userInfoService.updateBatchUserInfo(paramList));
     }

    /** 根据ID删除 **/
    @GetMapping("/delUserInfoById")
    public Results<Integer> delUserInfoById(Integer id) {
		return new Results().succeed(userInfoService.delUserInfoById(id));
	}

    /** 根据ID批量删除 **/
    @GetMapping("/delUserInfoByIds")
    public Results<Integer> delUserInfoByIds(List<Integer> ids) {
		return new Results().succeed(userInfoService.delUserInfoByIds(ids));
	}

}